package com.ibuonline.search.solr.extend.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ibuonline.search.solr.extend.dao.CompanyDao;
import com.ibuonline.search.solr.extend.model.Company;

@Service
public class CompanyManager {
	@Autowired
	private CompanyDao companyDao;

	public Company getCompany(Long id) {
		return companyDao.get(id);
	}

	public void saveCompany(Company company) {
		companyDao.save(company);
	}

	public List<Long> findOnlineCompanyUserIds() {
		return companyDao.findCompanyUserIdsByOnline(true);
	}

	public void deleteCompany(Long id) {
		companyDao.delete(id);
	}

	public float getCompanyScore(Long id) {
		Float score = companyDao.getScore(id);
		return score == null ? 0 : score;

	}
}
